package com.wq.payunion.oauth2.useroauth2.exceptions;

/**
 * @Author: wangqiang20995
 * @Date:2018 年 9 月 16 日 0016
 * @Description:
 * @Resource:
 */
public class OAuthException extends RuntimeException {
    private String errorCode;
    private Throwable exception;
    private String errorMessage;

    public OAuthException(Throwable e) {
        super(e);
        this.exception = e;
    }

    public OAuthException(String errorCode, String errorMessage, Throwable e) {
        super("OAuthCode[" + errorCode + "]/OAuthMessage[" + errorMessage + "]", e);
    }

    public OAuthException(String errorCode, String errorMessage) {
        super("OAuthCode[" + errorCode + "]/OAuthMessage[" + errorMessage + "]");
    }

    public Throwable getException() {
        return exception;
    }

    @Override
    public String getMessage() {
        return "Authorization Exception [" + errorMessage + "] with OAuthCode [" + errorCode + "]--> " + super.getMessage();
    }
}
